{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import utilsLY\n",
    "import matplotlib.pyplot as plt\n",
    "import matplotlib.ticker as mtick\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib \n",
    "matplotlib.rcParams['font.sans-serif'] = ['SimHei']\n",
    "matplotlib.rcParams['font.family'] = 'sans-serif'\n",
    "matplotlib.rcParams['axes.unicode_minus'] = False"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 一元线性回归"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 数据源来自于https://onlinecourses.science.psu.edu/stat501/node/325\n",
    "originX, Y = utilsLY.loadDataSet('data/temperature.txt')\n",
    "m, n = originX.shape\n",
    "X = np.concatenate((np.ones((m,1)), originX), axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "alpha = 0.00001\n",
    "maxloop = 10000\n",
    "epsilon =0.0001"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "theta, thetas, costs = utilsLY.bgd(alpha, X, Y, maxloop, epsilon)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAAEHCAYAAABbZ7oVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3Xd4VNXWx/HvohNBiiCKClhQbKAQUbyogKI0FSsqVy6Wm4AIiAVFUGxY0GujR7GAkVfFay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AriE4NPGk0PH81UI/DYBLCy1ikXzQcJNIPplZRXffGlpYr9p+T69x9+1m9gZwN1CO4MTG6UBN4Cd3f6ZwIxbJO/UkRPLvRjNbBTxPsHZOOaAywdLke4HzgUoES6E8QtD72Lc6ZxUzK+Xu6YUdtEheaE5CJP9aE6zAugq4g2DNpEnA5cDGUJ0K7v45wbBSKYKJ7nkES9QrQUiRpyQhkg9mdiRwiLtvArIas3UzO4XQ8s3uvgsYRLBc/enAhMKKVeRgaE5CJB9CCyYeQ3Dxm9YEq25mHm46GRgBfAp0BKoCPwHvEQw5NSeYm3jQ3T8q5PBFck1JQiSfzKyEu2dEOg6RcFKSEBGRbGlOQkREsqUkISIi2VKSEBGRbClJiIhItpQkREQkW/8Pa5ErGoiE9F4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x13232da1ba8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X[:, 1].flatten(), Y[:,0].flatten(), color='r')\n",
    "xCopy = X.copy()\n",
    "xCopy.sort(0)\n",
    "yHat = utilsLY.h(theta, xCopy)\n",
    "plt.plot(xCopy[:,1],yHat,color='g')\n",
    "plt.xlabel(u'温度')\n",
    "plt.ylabel(u'实验产出量')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEHCAYAAACumTGlAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3Xl4XOV59/HvPaNdsiTLkvfd2IANtgGBbSDGELYECISGJSmQviFx3gTSvk3zXpBCmiYF2qQJTUISihOaUghpIQtrEkgCxgbMIgM2qwMY7wuyZVu2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vdL7R3Z8imDvpTwQzZv48/IwXCMYOno/kHyjSR+oykpwUntFzHkFX0B+Bv3D3NeHmzxLcvAWCidj2Xofg7vVm9iDwfWCzma0IN/0CyEvT7fRDM/sN8HfhXD3/TnBjm+uB1WY2AZgGtADHEkz0JhILBYLkqs8B7xB0C10FnGdmbQQzWRYBlWaWBywhGGjey93/Kbzu4K+Aue6+AcDMzgV+5+7/vV/bq83sk8CgcDK0WwnGCmYDUwlmhv0KsBn4pZl9Kt34hEh/0OR2kpPMLBHH+f5mlufu7eGyAYnO6czNzFz/Q0qMFAgiIgJoUFlEREIKBBERARQIIiISUiCIiAgA/wvUeWqaSN64KwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x132301c9828>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(range(len(costs)), costs)\n",
    "plt.xlabel(u'迭代次数')\n",
    "plt.ylabel(u'代价')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 多项式回归"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = np.column_stack((originX[:,0], np.power(originX[:,0],2)))\n",
    "X, values = utilsLY.standarize(X)\n",
    "X = np.concatenate((np.ones((m,1)), X), axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "alpha = 0.01\n",
    "maxLoop = 50000\n",
    "epsilon =0.0000001"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "theta, thetas, costs = utilsLY.bgd(alpha, X, Y, maxloop, epsilon)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEHCAYAAACumTGlAAAABHNCSVQICAgIfAhkiAA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ADcDD7p7qZk1hN9zhaeAVyIHi3wHeI9gd9GBy2KiwZypbGZNgf8APnT3pfGup65Ejlo4G5gZ2ZWU1Bra+oLWOdnXORJ8pwFTK+YXqloWk5/VUAJBREQOLVnnEEREpIYUCCJRiOxyrOn3pIVRi0hYFAgi1Ygc2jrVzIaa2c1m9lmkdUSRmS0zs0uq+J4ewOR9HifrARySRDSHIBIFM+sM3ACsAd5397ciy38EbHf3v5vZEwRnDpfs+60Ef3jtcvfv1W3VIjWjLQSRaphZDpDu7jcDe4GHK5rqAbfuM3QPwVnT1wOb3P08gsNC5xC0IxCp17QZK1K9XcCfzOw2gv8zs4HiyHMn7jMuBfg+weGAPSLHy7eJfPUFzq+zikUOg3YZiUTBzFq4+9eRpnJtDnh6jbuXmNmzwP8DmhCcJPgG0BFY6u4P1G3FIjWnLQSR6FxuZiuAhwh6yTQBWhG03C4HhgAtCdqF/Ipgq6KiC2WmmTVy9z11XbRITWgOQSQ6Iwg6ja4AbiToIfQqcAGwOTKmubvPJtg11IhgEnoOQet1hYHUewoEkWqYWQegmbtvAarax+pm9h0iLYndfRfwMEEb9j7AK3VVq0htaA5BpBqRZoFdCC7UMoKgu+S+u4x6AY8CbwJ5QGtgKTCRYLfRGQRzCXe5+/Q6Ll8kagoEkSiYWYq77413HSJhUiCIiAigOQQREYlQIIiICKBAEBGRCAWCiIgACgQREYn4/75NTJF3uQJSAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x132350e1fd0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(originX[:, 0].flatten(), Y[:,0].flatten(), color='r')\n",
    "xx = np.linspace(50,100,50)\n",
    "xx2 = np.power(xx,2)\n",
    "yHat = []\n",
    "for i in range(50):\n",
    "    normalizedSize = (xx[i]-values[0][0])/values[0][1]\n",
    "    normalizedSize2 = (xx2[i]-values[1][0])/values[1][1]\n",
    "    x = np.matrix([[1,normalizedSize, normalizedSize2]])\n",
    "    \n",
    "    yHat.append(utilsLY.h(theta, x)[0,0])\n",
    "plt.plot(xx, yHat,color='g')\n",
    "plt.xlabel(u'温度')\n",
    "plt.ylabel(u'实验产出量')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 135,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEHCAYAAACumTGlAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAGsJJREFUeJzt3X2QXNV95vHv090jobcgYQaxuDAyjspZdo2yeIIlg6kxRjhmsc3iFxzb2Fnbq00WyB/Z1IJXSmXNgmNTCanYLnAUKxtC/BKcXVMBmwKzhqCAMIxsQ1hnqXWIIJYNHtCbkdDbzG//uHdmenpu922N5s7beT5VU7p9+9zb57RAz5xzzz1XEYGZmVltpitgZmazgwPBzMwAB4KZmeUcCGZmBjgQzMws50AwMzPAgWBmZjkHgpmZAQ4EMzPLNWa6Asfi5JNPjlWrVs10NczM5ozt27e/GBG93ZSdU4GwatUqBgYGZroaZmZzhqRnuy3rISMzMwMcCGZmlnMgmJkZ4EAwM7OcA8HMzAAHgpmZ5eZ9IEQEO/e8wr6DR2a6KmZms9q8D4QjQ8F5n/kOt2/reiqumVmS5n0g1JT9OTTsZ0ebmXUy7wOhnifCcDgQzMw6qTQQJK2U9P0O72+RtE3SpgrrAIA7CGZmnVXdQ/gDYFHRG5IuB+oRsQ44U9LqqipREww7EczMOqosECRdCOwHnm9TpB+4I9++Dzi/zXk2SBqQNDA4ODiputRr8pCRmVmJSgJB0gLgd4HrOhRbAuzMt3cBK4sKRcTmiOiLiL7e3q5WcC2qD0MOBDOzjqrqIVwH3BIRezqUeZmx4aSlFdaFuoTzwMyss6r+Eb4IuErSg8AvS/pSQZ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AS4SdI/RMQ/R8TLkk6X9ImI+BLZDVUH8zV2AHZHxL+TtJRsqYJ1wCnAqWRTLPdHxJCkGkBEDE9D280mcCBYyv5rRBySdB3wK4zd+PVZsmUTkLQe+ElEHMiPORoRByVdAryObNkQyJZb+BNJzwFbye66PQD8ImPLbZwIvAq4GvgB8Ei+/YuSHsrLXgY8VlmLzTpwIFiSJH0c+ISkPwQuBS4GTgIWkt0VvVDS1cCNwDOS3kQWGqdL+muyf+yfIPvHn4jYD3xY0meBTwEbyBbhewn4cv6xQ2Sh84fA68l6CGcDG8nuSv6PEeEwsBnjQLAkRcQWSYeApRFxPoCk24B9EXFN/vo/AfeQ/eP9auBp4HHg2oj4x9ZzSvoScHXegziFbKjorqYiDbKwuBK4mWzo6dNk1xsOA89U0lizLvmishmQ9wBOAQYlfTrf/adkCwgSEf8rX3L8buDtBce/LS93MJ+V9GayO2ebnQHcCnyUbEjpbuDdZIGwjuNYcsBsKjgQLHn5dYItZEM215ON6f9ORBwpKP4/gV+XVBuZjippCdnQ0ifzMtcBXwH+TtKnRg6MiIfJ1q3/32Srl345/4zvkV07eLySBpp1yUNGlqR8Rs87yYaC7gfeExHP5W9/AnjbSNH8B4CIGJR0F/DHwAuSns7f+irQKBh2+oKkbwD/OSKeAb5I9pCfTcCzkl4L/CvgENmChQNVtdmsjAPBUvUfgH8iGxa6CninpCNkq4qeACyX1CBbdXNh84ER8d/z+w5+HbggIn4CIOlS4J6I+FpT2asl/RrZIyFXkA0ZPUO2IudZZKt7/g7wAvDXkj5YdH3CbDp4cTtLkqTaTMz3l9SIiKP5toBaRAyNvA7/D2kzyIFgZmaALyqbmVnOgWBmZoADwczMcg4EMzMD4P8D2nnfPkSqm1kAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1f00014db38>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(range(len(costs)), costs)\n",
    "plt.xlabel(u'迭代次数')\n",
    "plt.ylabel(u'代价')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
